Re: [SQL] copy one to many?

Поиск
Список
Период
Сортировка
От Herouth Maoz
Тема Re: [SQL] copy one to many?
Дата
Msg-id l03110704b20ec19e0700@[147.233.159.109]
обсуждение исходный текст
Ответ на Re: [SQL] copy one to many?  (Walt Bigelow <walt@stimpy.com>)
Список pgsql-sql
At 6:06 +0300 on 28/8/98, Walt Bigelow wrote:


> I was looking more on the lines of a list of dest values.  This list is by
> no means in order, or sequential.
>
> For example: I want to copy this data TO this list of lib #'s
>
> 3422, 4456, 7743... etc  (baiscally random)
>
> I'd prefer to have 1 insert statment do the job.  Right now I have M$
> Access doing this in a for/next loop, changing the dest lib number for
> each in the list.
>
> I'd prefer to do this on the server end.  Whould this be easy to do with
> server side funcs?

Well.... SQL was NOT designed as a procedural language, and when you have
data of a 'random' nature, as you said, you need a procedural languague,
which the current backend doesn't have.

If you want to insert just the new lib numbers into an auxiliary table, you
can easily do the insert as a cartesian product between the rows you want
to duplicates and the rows in the auxiliary table.

Of course, then you'll need a loop for inserting the lib values into the
auxiliary table - or you can do that with a COPY.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma



В списке pgsql-sql по дате отправления:

Предыдущее
От: Herouth Maoz
Дата:
Сообщение: Re: [SQL] Contertine timespan to hours
Следующее
От: Cho Yan Wong
Дата:
Сообщение: Re: [SQL] copy probs